<?php 
namespace Admin\Controller;
use \Think\Controller;

header("content-type:text/html;charset=utf-8");

date_default_timezone_set('PRC');

class PublicController extends Controller
{
	// 初始化设置,进行权限判断
	public function _initialize()
	{
		if (empty($_SESSION['adname'])) {
			$this->display('Admin/login');
			exit;
		}
		// var_dump($_SESSION['node']);

		$controller = CONTROLLER_NAME;  // 获取控制器名
		$method = ACTION_NAME;  // 获取方法名
		$node = $controller.'_'.$method;  // 拼接权限字符
		
		if (($_SESSION['adname'] != 'admin') && ($node != 'Index_index')) {
			if(!in_array($node,$_SESSION['node'])){
				// echo $node;exit;
				$this->error('抱歉!您没有该操作的权限...');
				exit;
			}
		}


	}

}
